package com.jiangnan.controller;

import com.jiangnan.pojo.JobOption;
import com.jiangnan.pojo.Result;
import com.jiangnan.pojo.StudentCountOption;
import com.jiangnan.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/empJobData")
    public Result getEmpJobData() {
        JobOption jobOption = reportService.getEmpJobData();
        log.info("获取报表数据成功：{}", jobOption);
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<Map<String, Object>> genderOption = reportService.getEmpGenderData();
        log.info("获取报表数据成功：{}", genderOption);
        return Result.success(genderOption);
    }

    @GetMapping("/studentCountData")
    public Result getStudentCountData() {
        StudentCountOption studentCountOption = reportService.getStudentCountData();
        log.info("获取报表数据成功：{}", studentCountOption);
        return Result.success(studentCountOption);
    }

    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData() {
        List<Map<String, Object>> degreeOption = reportService.getStudentDegreeData();
        log.info("获取报表数据成功：{}", degreeOption);
        return Result.success(degreeOption);
    }


}
